package month4.day6;

public class Teacher {
    private String name;
    private int age;
    private String school;
    public void show(){
        System.out.println("我是"+name+"，今年"+age+"岁，任职"+school+"。");
    }
    public void teachering(){
        System.out.println("教学生上课");
    }

    public void setAge(int age)throws Exception{
        if(age<22)
            throw new Exception("年龄异常");
        else {
            this.age=age;
        }
    }

    public Teacher() {
    }

    public Teacher(String name, int age, String school) {
        this.name = name;
        this.age = age;
        this.school = school;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }
}
